﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Utils.DatabaseUtils;
using Utils;

namespace Entity
{
    public class PaymentMethodsUI
    {

        int _PM_ID;

        public int PM_ID
        {
            get { return _PM_ID; }
            set { _PM_ID = value; }
        }


        string _PM_Name;

        public string PM_Name
        {
            get { return _PM_Name; }
            set { _PM_Name = value; }
        }


        public int Add(string PM_Name)
        {
            try
            {
                int result = SqlHelper.ExecuteNonQuery(Common.Conn, "PaymentMethods_add", PM_Name);
                return result;
            }
            catch (Exception ex)
            {
                return -1;
            }
        }

        public int Delete(int PM_ID)
        {
            try
            {
                int result = SqlHelper.ExecuteNonQuery(Common.Conn, "PaymentMethods_delete", PM_ID);
                return result;
            }
            catch (Exception ex)
            {
                return -1;
            }
        }

        public DataSet Get(int PM_ID)
        {
            try
            {
                DataSet result = SqlHelper.ExecuteDataset(Common.Conn, "PaymentMethods_get", PM_ID);
                return result;
            }
            catch (Exception e) { return null; }
        }

        public DataSet GetAll()
        {
            try
            {
                DataSet result = SqlHelper.ExecuteDataset(Common.Conn, "PaymentMethods_getall");
                return result;
            }
            catch (Exception e) { return null; }
        }

        public int Update(int PM_ID, string PM_Name)
        {
            try
            {
                int result = SqlHelper.ExecuteNonQuery(Common.Conn, "PaymentMethods_update", PM_ID,PM_Name);
                return result;
            }
            catch (Exception ex)
            {
                return -1;
            }

        }
    }
}
